package test3;

import java.util.List;

import org.junit.Test;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import cn.tedu.store.bean.Address;
import cn.tedu.store.mapper.AddressMapper;

public class addresstest {
	@Test
	public void setAddresstest(){
		AbstractApplicationContext ac=new ClassPathXmlApplicationContext("spring-dao.xml","spring-service.xml");
		AddressMapper im=ac.getBean("addressMapper",AddressMapper.class);
		Address a=new Address();
		a.setUid(2);
		a.setRecvName("maomao");
		a.setRecvProvince("110000");
		a.setRecvCity("110100");
		a.setRecvArea("110101");
		a.setRecvDistrict("111");
		a.setRecvAddr("1111");
		a.setRecvPhone("13110112951");
		im.insert(a);
	}
	@Test
	public void getAddressByUid(){
		AbstractApplicationContext ac=new ClassPathXmlApplicationContext("spring-dao.xml","spring-service.xml");
		AddressMapper im=ac.getBean("addressMapper",AddressMapper.class);
		List<Address> list=im.getAddressByUid(2);
		System.out.println(list);
	}
}
